@@ -1,3 +1,10 @@
+[0.014] Mon Aug 30 22:52:30 EST 2010
+ - Fixed regression introduced in last version related to how
+ we expand 'shortname' actionrole namespaces. We now revert
+ to the old behavior until we can reconcile with what is done
+ in Catalyst::Controller::ActionRole.
+ - Created tests to prevent above regression in the future
+
[0.013] Wed Aug 25 19:29:01 EST 2010
- Controller now inherits from Catalyst::Controller::ActionRole
- ActionRoles can now be parameterized
@@ -75,6 +75,7 @@ t/080_models.t
t/100_complex.t
t/110_under_sequence.t
t/510_render_view.t
+t/lib/Catalyst/ActionRole/hasActionParams_CatNS.pm
t/lib/Catalyst/Plugin/CatalystX/Declare/TestPlugin.pm
t/lib/PlainTestApp.pm
t/lib/PlainTestApp/Controller/Root.pm
@@ -83,6 +84,7 @@ t/lib/RenderViewTestApp/Action/RenderView.pm
t/lib/RenderViewTestApp/Controller/Root.pm
t/lib/RenderViewTestApp/View/Test.pm
t/lib/TestApp.pm
+t/lib/TestApp/ActionRole/hasActionParams_AppNS.pm
t/lib/TestApp/Controller/ActionParams.pm
t/lib/TestApp/Controller/Composed.pm
t/lib/TestApp/Controller/DynamicFinal/Bar.pm
@@ -26,7 +26,7 @@ no_index:
provides:
CatalystX::Declare:
file: lib/CatalystX/Declare.pm
- version: 0.013
+ version: 0.014
CatalystX::Declare::Action::CatchValidationError:
file: lib/CatalystX/Declare/Action/CatchValidationError.pm
CatalystX::Declare::Context::AppSetup:
@@ -83,4 +83,4 @@ resources:
bugtracker: http://github.com/phaylon/catalystx-declarative/issues
license: http://dev.perl.org/licenses/
repository: http://github.com/phaylon/catalystx-declarative/tree/master
-version: 0.013
+version: 0.014
@@ -52,16 +52,22 @@ role CatalystX::Declare::Controller::ActionPreparation {
$self->_ensure_applied_dispatchtype_roles;
}
+
around gather_action_roles(%args) {
return (
$self->$orig(%args),
- @{ delete($args{attributes}{CatalystX_Declarative_ActionRoles}) || [] },
+ (map {
+ $self->_qualify_class_name(ActionRole => $_);
+ #$self->_expand_role_shortname($_);
+ } @{ delete($args{attributes}{CatalystX_Declarative_ActionRoles}) || [] }),
+ @{ delete($args{attributes}{CatalystX_Declarative_DefaultActionRoles}) || [] },
);
}
around create_action (%args) {
my $action = $self->$orig(%args);
+ ## TODO Do we really need this anymore?
return $action
if $args{attributes}{Private};
@@ -300,7 +300,7 @@ class CatalystX::Declare::Keyword::Action {
$attrs->{Signature} = $proto;
$attrs->{Action} = [];
- push @{ $attrs->{CatalystX_Declarative_ActionRoles} ||= [] }, CatchValidationError;
+ push @{ $attrs->{CatalystX_Declarative_DefaultActionRoles} ||= [] }, CatchValidationError;
# default chained base to the global under var, to be resolved at runtime
$attrs->{Chained} ||= UNDER_VAR;
@@ -11,7 +11,7 @@ class CatalystX::Declare extends MooseX::Declare is dirty {
clean;
- our $VERSION = '0.013';
+ our $VERSION = '0.014';
around keywords (ClassName $self:) {
$self->$orig,
@@ -73,4 +73,7 @@ is get('/actionparams/second'), 'action_args_second: 200,201', 'actionrole with
is get('/actionparams/third'), 'action_args_third: 300,301', 'actionrole with params (part three)';
is get('/actionparams/forth'), 'action_args_forth: 400,1,401,2', 'actionrole with params (part four)';
+is get('/actionparams/first_app_ns'), 'action_args_first: 100,101', 'actionrole with params (from App NS)';
+is get('/actionparams/first_cat_ns'), 'action_args_first: 100,101', 'actionrole with params (from Cat NS)';
+
done_testing;
@@ -0,0 +1,16 @@
+package Catalyst::ActionRole::hasActionParams_CatNS;
+use Moose::Role;
+
+has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
+
+sub _build_p1 {
+ my $self = shift @_;
+ return join ',', @{$self->attributes->{p1}};
+}
+
+sub _build_p2 {
+ my $self = shift @_;
+ return join ',', @{$self->attributes->{p2}};
+}
+
+1;
@@ -0,0 +1,12 @@
+use CatalystX::Declare;
+namespace TestApp;
+role ::ActionRole::hasActionParams_AppNS {
+ has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
+ method _build_p1 {
+ join ',', @{$self->attributes->{p1}};
+ }
+ method _build_p2 {
+ join ',', @{$self->attributes->{p2}};
+ }
+}
+
@@ -19,15 +19,15 @@ controller ::Controller::ActionParams {
as 'actionparams';
action first under base
- with hasActionParams(p1=>100,p2=>101)
- is final {
+ with hasActionParams(p1=>100,p2=>101)
+ is final {
my $p1 = $ctx->controller->action_for('first')->p1;
my $p2 = $ctx->controller->action_for('first')->p2;
$ctx->response->body("action_args_first: $p1,$p2");
}
action second under base
- with hasActionParams({p1=>200,p2=>201})
+ with hasActionParams({p1=>200,p2=>201})
is final {
my $p1 = $ctx->controller->action_for('second')->p1;
my $p2 = $ctx->controller->action_for('second')->p2;
@@ -53,5 +53,22 @@ controller ::Controller::ActionParams {
my $p2 = $ctx->controller->action_for('forth')->p2;
$ctx->response->body("action_args_forth: $p1,$p2");
}
+
+ action first_app_ns under base
+ with hasActionParams_AppNS(p1=>100,p2=>101)
+ is final {
+ my $p1 = $ctx->controller->action_for('first')->p1;
+ my $p2 = $ctx->controller->action_for('first')->p2;
+ $ctx->response->body("action_args_first: $p1,$p2");
+ }
+
+ action first_cat_ns under base
+ with hasActionParams_CatNS(p1=>100,p2=>101)
+ is final {
+ my $p1 = $ctx->controller->action_for('first')->p1;
+ my $p2 = $ctx->controller->action_for('first')->p2;
+ $ctx->response->body("action_args_first: $p1,$p2");
+ }
+
}